package a.d;

import a.c.y;
import a.c.z;

import java.util.Iterator;
import java.util.TreeSet;

class e
  implements m.c_
{
  private i a;
  private int b;
  private int c;
  private int d;
  private static final m.a_ e = new m.a_((1.0D / 0.0D), (1.0D / 0.0D), null, -1);
  private static final m.a_ f = new m.a_((-1.0D / 0.0D), (-1.0D / 0.0D), null, -1);
  private static final l g = new l(true);
  private static final l h = new l(false);
  private j i;
  
  public e()
  {
    this.a = null;
    this.i = null;
    this.b = 0;
    this.c = -1;
    this.d = 0;
  }
  
  public e(z paramz)
  {
    TreeSet localTreeSet = new TreeSet();
    Object localObject1 = paramz.h();
    if (((y)localObject1).e()) {}
    while (bool2)
    {
      localObject2 = ((m.d_)((y)localObject1).j()).d();
      localTreeSet.add(new Double(((m.a_)localObject2).a));
      if (!bool2)
      {
        if (bool1) {
          break label114;
        }
        localTreeSet.add(new Double(((m.a_)localObject2).b));
        ((y)localObject1).f();
      }
      if (!bool1) {
        break;
      }
    }
    label114:
    localObject1 = new double[localTreeSet.size()];
    Object localObject2 = localTreeSet.iterator();
    int j = 0;
    do
    {
      while (!bool1)
      {
        if (j >= localObject1.length) {
          break;
        }
        localObject1[j] = ((Double)((Iterator)localObject2).next()).doubleValue();
        j++;
      }
    } while (bool2);
    localTreeSet = null;
    System.gc();
    this.b = 0;
    this.c = 0;
    this.d = 0;
    this.i = new j();
    if (!bool2) {
      if (localObject1.length == 0)
      {
        this.a = null;
        if (!bool2) {
          if (!bool1) {
            break label242;
          }
        }
      }
      else
      {
        this.a = new i();
      }
    }
    a((double[])localObject1, 0, localObject1.length, this.a);
    label242:
    localObject1 = null;
    System.gc();
  }
  
  public e(double[] paramArrayOfDouble)
  {
    this.b = 0;
    this.c = 0;
    this.d = 0;
    this.i = new j();
    if (!bool) {
      if (paramArrayOfDouble.length == 0)
      {
        this.a = null;
        if (!bool) {
          if (!w.d) {
            return;
          }
        }
      }
      else
      {
        this.a = new i();
      }
    }
    a(paramArrayOfDouble, 0, paramArrayOfDouble.length, this.a);
  }
  
  private void a(double[] paramArrayOfDouble, int paramInt1, int paramInt2, i parami)
  {
    boolean bool = w.e;
    this.b += 1;
    if (!bool) {
      if (paramInt2 == 1)
      {
        parami.a = paramArrayOfDouble[paramInt1];
        if ((!bool) && (!w.d)) {
          return;
        }
      }
    }
    int j = paramInt1 + (paramInt2 - 1) / 2;
    double d1 = (paramArrayOfDouble[j] + paramArrayOfDouble[(j + 1)]) * 0.5D;
    parami.a = d1;
    parami.b = new ab(g);
    parami.c = new ab(h);
    parami.e = new i();
    parami.g = new i();
    a(paramArrayOfDouble, paramInt1, (paramInt2 + 1) / 2, parami.e);
    a(paramArrayOfDouble, j + 1, paramInt2 / 2, parami.g);
  }
  
  private int a()
  {
    if (!w.e) {
      if (this.c != -1) {
        this.c += 1;
      }
    }
    return this.c;
  }
  
  public int b()
  {
    return this.d - 1;
  }
  
  public void a(m.a_ parama_)
  {
    boolean bool2 = w.e;
    boolean bool1 = w.d;
    i locali = this.a;
    double d1;
    do
    {
      d1 = locali.a;
      if (parama_.b >= d1) {
        break;
      }
      locali = locali.e;
      if (bool2) {
        break label96;
      }
      if (bool1) {
        break label89;
      }
    } while ((!bool2) && (!bool1));
    do
    {
      if (bool2) {
        break label88;
      }
      if (parama_.a > d1)
      {
        locali = locali.g;
        if (!bool1) {
          break;
        }
      }
    } while (bool2);
    label88:
    locali.a(parama_);
    label89:
    label96:
    if (!bool2) {
      if (locali.b.size() == 1)
      {
        locali.b.a(e);
        locali.c.a(f);
      }
    }
    if (locali.b.size() > this.d) {
      this.d = locali.b.size();
    }
  }
  
  public void c(m.a_ parama_)
  {
    boolean bool2 = w.e;
    boolean bool1 = w.d;
    i locali = this.a;
    double d1;
    do
    {
      d1 = locali.a;
      if (parama_.b >= d1) {
        break;
      }
      locali = locali.e;
      if (bool2) {
        break label96;
      }
      if (bool1) {
        break label89;
      }
    } while ((!bool2) && (!bool1));
    do
    {
      if (bool2) {
        break label88;
      }
      if (parama_.a > d1)
      {
        locali = locali.g;
        if (!bool1) {
          break;
        }
      }
    } while (bool2);
    label88:
    locali.b(parama_);
    label89:
    label96:
    if ((bool2) || (locali.b.size() == 1))
    {
      int j = locali.b.indexOf(e);
      if (!bool2)
      {
        if (j >= 0) {
          locali.b.remove(j);
        }
        j = locali.c.indexOf(f);
        if (bool2) {}
      }
      else
      {
        if (j < 0) {
          return;
        }
        locali.c.remove(j);
      }
    }
  }
  
  public void a(m.a_ parama_, m.g_ paramg_)
  {
    boolean bool2 = w.e;
    boolean bool1 = w.d;
    double d1 = parama_.a;
    double d2 = parama_.b;
    Object localObject = parama_.d;
    i locali = this.a;
    for (;;)
    {
      if (locali == null)
      {
        if ((!bool2) && (!bool1)) {
          if (this.i.b()) {
            break;
          }
        }
      }
      else
      {
        if (bool2) {
          break label79;
        }
        if (locali != null) {
          break label77;
        }
      }
      locali = this.i.a();
      label77:
      label79:
      double d3 = locali.a;
      int j;
      m.a_ locala_2;
      if (!bool2) {
        if (d2 < d3)
        {
          localab = locali.b;
          if (!bool2)
          {
            if (localab.size() > 0)
            {
              j = 0;
              locala_2 = (m.a_)localab.get(j);
              do
              {
                if (d2 < locala_2.a) {
                  break;
                }
                paramg_.a(localObject, locala_2.d);
                locala_2 = (m.a_)localab.get(++j);
                if ((!bool2) && (bool1)) {
                  break label224;
                }
              } while (!bool1);
            }
            if (!bool2) {
              if (bool2) {
                break label374;
              }
            }
          }
          else
          {
            if (locali.e.b == null) {
              break label224;
            }
          }
          if (bool2) {
            continue;
          }
          locali = locali.e;
          if (!bool1) {
            continue;
          }
          label224:
          locali = null;
          continue;
        }
      }
      if (d1 > d3)
      {
        localab = locali.c;
        if (!bool2)
        {
          if (localab.size() > 0)
          {
            j = 0;
            locala_2 = (m.a_)localab.get(j);
            do
            {
              if (d1 > locala_2.b) {
                break;
              }
              paramg_.a(localObject, locala_2.d);
              locala_2 = (m.a_)localab.get(++j);
              if ((!bool2) && (bool1)) {
                break label363;
              }
            } while (!bool1);
          }
          if (!bool2) {
            if (bool2) {
              break label374;
            }
          }
        }
        else
        {
          if (locali.g.b == null) {
            break label363;
          }
        }
        if (bool2) {
          continue;
        }
        locali = locali.g;
        if (!bool1) {
          continue;
        }
        label363:
        locali = null;
      }
      label374:
      ab localab = locali.b;
      int k = 0;
      if (k < localab.size() - 1)
      {
        if (bool2) {}
      }
      else
      {
        while (bool2)
        {
          m.a_ locala_1 = (m.a_)localab.get(k);
          paramg_.a(localObject, locala_1.d);
          k++;
          if (bool1) {
            break label467;
          }
          if (!bool1) {
            break;
          }
        }
        if (!bool2) {
          if (locali.g.b != null) {
            this.i.a(locali.g);
          }
        }
      }
      label467:
      if ((bool2) || (locali.e.b != null))
      {
        if (!bool2)
        {
          locali = locali.e;
          if (!bool1) {}
        }
      }
      else {
        locali = null;
      }
    }
  }
  
  private void a(i parami, int paramInt1, int paramInt2, StringBuffer paramStringBuffer1, StringBuffer paramStringBuffer2)
  {
    boolean bool = w.e;
    paramStringBuffer1.append("\tnode\n\t[\n\t\tid\t" + paramInt1 + "\n" + "\t\tlabel\t\"" + parami.toString() + "\"\n" + "\t]\n");
    if (!bool) {
      if (paramInt2 != 0) {
        paramStringBuffer2.append("\tedge\n\t[\n\t\tsource\t" + paramInt2 + "\n" + "\t\ttarget\t" + paramInt1 + "\n" + "\t\tlabel\t\"\"\n" + "\t]\n");
      }
    }
    int j = paramInt1;
    i locali;
    if (!bool) {
      if ((locali = parami.e) != null) {
        a(locali, a(), j, paramStringBuffer1, paramStringBuffer2);
      }
    }
    if ((locali = parami.g) != null) {
      a(locali, a(), j, paramStringBuffer1, paramStringBuffer2);
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.d.e

 * JD-Core Version:    0.7.0.1

 */